#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n+1; i++)
    {
        if (i < 10)
            printf("%d\n", i);
        else
        {
            int t = 0;
            int x = i;
            while (x > 0)
            {
                t = t * 10 + x % 10;
                    x = x/10;
            }
            if (i == t )
                printf("%d\n", i);
        }
    }
}